textview: Fix a problem with the last line
authorMatthias Clasen <mclasen@redhat.com>
Tue, 6 Apr 2021 15:07:50 +0000 (11:07 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 6 Apr 2021 15:09:05 +0000 (11:09 -0400)
Sometimes, we missed the last line for display.

Fixes: #3835
gtk/gtktextlayout.c

index 0d808d6bfb8e29ece084b725d77d78b99cf1a010..d127c489b2e7e6e4c5a79f2cbd6b6411c322bb7d 100644 (file)
@@ -4114,7 +4114,7 @@ gtk_text_layout_snapshot (GtkTextLayout      *layout,
   gtk_text_layout_wrap_loop_start (layout);
 
   for (GtkTextLine *line = first_line;
-       line != last_line;
+       line != NULL;
        line = _gtk_text_line_next_excluding_last (line))
     {
       GtkTextLineDisplay *line_display;
@@ -4222,6 +4222,9 @@ gtk_text_layout_snapshot (GtkTextLayout      *layout,
       offset_y += line_display->height;
 
       gtk_text_line_display_unref (line_display);
+
+      if (line == last_line)
+        break;
     }
 
   gtk_text_layout_wrap_loop_end (layout);